import request from '@/router/axios'
import {
  approveStatusBelong,
  getApproveStatus,
  getLineName,
  getStationName,
  getMappingStatus,
  numToTwoPoint
} from "../commonCheck";

export function getReportErrorList(query) {
  return request({
    url: '/check/check/getReportErrorList',
    method: 'post',
    params: query
  })
}
export function updateReportApplyStatus(param) {
  return request({
    url: '/check/check/updateReportApplyStatus',
    method: 'post',
    data: param
    //params: param
  })
}
export function updateReportApplyModifyLimitTime(param) {
  return request({
    url: '/check/check/updateReportApplyModifyLimitTime',
    method: 'post',
    params: param
  })
}


/**
 *
 * @param param
 */
export function getmodifyLimitTime(param) {
  return request({
    url: '/check/check/getmodifyLimitTime',
    method: 'post',
    params: param
  })
}

/**
 *
 * @param param
 */
export function updateReportCheckStatus(param) {
  return request({
    url: '/check/check/updateReportCheckStatus',
    method: 'post',
    params: param
  })
}


export const tableOption={
  editBtn:false,
  delBtn:false,
  addBtn:false,
  border: true,
  index:true,
  indexLabel:'序号',
  page:true,
  align:'center',
  menuWidth:150,
  menuAlign:'center',
  emptyBtn:false,
  selection: true,
  reserveSelection:false,
  column:[
    {prop:"lineCode",width:100, label:"线路",type:'select',search:true,searchslot:true,formatter: function(row, value , label, column){
        return getLineName(value);
      }},
    {prop:"stationCode",width:180, label:"站点",search:true,searchslot:true,formatter: function(row, value , label, column){
        return getStationName(row.lineCode,value);
      }},
    {prop:"applyTime" ,label:"申请时间", type: 'datetime',
      width: 100, format: 'yyyy-MM-dd', valueFormat: 'yyyy-MM-dd'},
    {prop:"reprotTime", label:"报表时间",type: 'datetime',
      width: 100, format: 'yyyy-MM-dd', valueFormat: 'yyyy-MM-dd'},
    {prop:"errorClassification",label:"差错类别",formatter:function (row,v) {
      return getMappingStatus('ERROR_CLASSIFICATION',v);
    }},
    // {prop:"errorAmount", label:"差异金额",formatter:function (row,v) {
    //     return numToTwoPoint(v);
    //   }},
    {prop:"applyReason" ,label:"申请原因",width:200},
    {prop:"reportName", label:"报表名称",width:200},
    {prop:"creatorName" ,label:"申请人",width:120},
    {prop:"creatorCode", label:"申请人工号",width:120},
    {prop:"modifyTime", label:"更改日期",width:120},
    {prop:"isModify",width:120, label:"修改状态",
      formatter:function(row, value , label, column){
        return value==1?'已完成':value==2?'修改中':value==0?'未完成':'';
      },
      dicData: [{
        label: '未完成',
        value: '0'
      },{
        label: '修改中',
        value: '2'
      }, {
        label: '已完成',
        value: '1'
      }]
    },
    {prop:"modifyLimitTime", label:"修改期限（天）",width:120},
    {prop:"checkStatus",width:120, label:"审批状态",type:'select',search:true,searchValue:'2',dicData:approveStatusBelong(),formatter:function(row,value){
        return getApproveStatus(value);
      }}]
}
